home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / os2 / room_os2.zip / ROOM.C < prev    next >
Text File  |  1995-08-09  |  3KB  |  154 lines

  1. #include <stdio.h>
  2. #include <time.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include "room.h"
  6.  
  7. int main(int argc, char **argv)
  8. {
  9. int loop, loop2;
  10. int num_room;
  11. int num_junk;
  12. int has_sound;
  13. int has_trap;
  14. int seed;
  15. int is_html = 0;
  16. if (argc < 2)
  17.      {
  18.      printf("useage: stuff number of rooms [seed]");
  19.      return(0);
  20.      }
  21. else if (argc == 2)
  22.      {
  23.  
  24.      if (strcmp("HTML",argv[1]) == 0)
  25.           {
  26.           num_room = 1;
  27.           seed = time(NULL);
  28.           is_html = 1;
  29.           }
  30.      else
  31.           {
  32.           num_room = atoi(argv[1]);
  33.           seed = time(NULL);
  34.           }
  35.      }
  36. else
  37.      {
  38.      num_room = atoi(argv[1]);
  39.      seed = atoi(argv[2]);
  40.      }
  41. srand (seed);
  42.  
  43. if (num_room < 1)
  44.      {
  45.      for(loop = 0; loop < 100; loop++)
  46.           printf("air_currents[%d] [%s]\n",loop+1,air_currents[loop]);
  47.      printf("\n");
  48.      for(loop = 0; loop < 100; loop++)
  49.           printf("odors[%d] [%s]\n",loop+1,odors[loop]);
  50.      printf("\n");
  51.      for(loop = 0; loop < 100; loop++)
  52.           printf("air[%d] [%s]\n",loop+1,air[loop]);
  53.      printf("\n");
  54.  
  55.      for(loop = 0; loop < 100; loop++)
  56.           printf("junk[%d] [%s]\n",loop+1,junk[loop]);
  57.      printf("\n");
  58.  
  59.      for(loop = 0; loop < 100; loop++)
  60.           printf("sounds[%d] [%s]\n",loop+1,sounds[loop]);
  61.      printf("\n");
  62.  
  63.      for(loop = 0; loop < 100; loop++)
  64.           printf("traps[%d] [%s]\n",loop+1,traps[loop]);
  65.      printf("\n");
  66.  
  67.      }
  68. else
  69.      {
  70.      if (is_html)
  71.           {
  72.           printf("<HTML><TITLE>A Random Room</TITLE><H4>");
  73.           }
  74.      for (loop = 0; loop < num_room; loop++)
  75.           {
  76.           if (is_html)
  77.                 {
  78.                 printf("A Dungeon Room<BR><P>");
  79.                 }
  80.           else
  81.                 {
  82.                 printf("Room %d\n",loop + 1);
  83.                 }
  84.           printf("Air Current: %s\n",air_currents[rand() % 100]);
  85.           if (is_html)
  86.                 {
  87.                 printf("<BR>");
  88.                 }
  89.           printf("General Odor: %s\n",odors[rand() % 100]);
  90.           if (is_html)
  91.             {
  92.             printf("<BR>");
  93.             }
  94.         printf("Air State : %s\n",air[rand() %100]);
  95.         if (is_html)
  96.             {
  97.             printf("<BR>");
  98.             }
  99.         num_junk = rand() % 11;
  100.         if (num_junk)
  101.             {
  102.             if (is_html)
  103.                 {
  104.                 printf("<HR>");
  105.                 }
  106.             printf("General Items in room:\n");
  107.             if (is_html)
  108.                 {
  109.                 printf("<OL>");
  110.                 }
  111.             for (loop2 = 0; loop2 < num_junk; loop2++)
  112.                 {
  113.                 if (is_html)
  114.                     {
  115.                     printf("<LI>%s<BR>\n",junk[rand() % 100]);
  116.                     }
  117.                 else
  118.                     {
  119.                     printf("\t%d -- %s\n",loop2 + 1,junk[rand() % 100]);
  120.                     }
  121.                 }
  122.             if (is_html)
  123.                 {
  124.                 printf("</OL>");
  125.                 }
  126.             }
  127.         has_sound = rand() % 4;
  128.         if (!has_sound)
  129.             {
  130.             if (is_html)
  131.                 {
  132.                 printf("<HR>");
  133.                 }
  134.             printf("Sound in room: %s\n",sounds[rand() % 100]);
  135.             }
  136.         has_trap = rand() % 10;
  137.         if (!has_trap)
  138.             {
  139.             if (is_html)
  140.                 {
  141.                 printf("<HR>");
  142.                 }
  143.             printf("Trap in room: %s\n",traps[rand() % 100]);
  144.             }
  145.         printf("\n");
  146.         }
  147.     if (is_html)
  148.         {
  149.         printf("</H4></HTML>");
  150.         }
  151.     }
  152. return(0);
  153. }
  154.